<!DOCTYPE html>
<html lang="pl">
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
<?php

include("config.php");
include('ajax.php');

$form = new Form();
/*
foreach ($tags as $tag)
{
    $tagName = $tag['tagName'];
    if (strstr($tagName, 'Age'))
       $ageTags[$tag['tagId']] = "<img src='{$tag['tagUrl']}' alt='{$tag['tagName']}' />";
    else
       $warningTags[$tag['tagId']] = "<img src='{$tag['tagUrl']}' alt='{$tag['tagName']}' />";
}

$form->addInput(new FormRadioInput("PegiAge", true, $ageTags, array(
                                                                    'label' => 'Wiek',
                                                                    'checked' => '4',
                                                                )));
$form->addInput(new FormCheckboxInput("PegiTag", false, $warningTags, array(
                                                                            'label' => 'Oznaczenia',
                                                                            )));
$form->addInput(new FormInput("metascore", false, "text", "int", false, array('disabled' => 'disabled')));
$form->addInput(new FormInput("getMetascore", false, "button", null, "Button", array()));
//$form->addInput(new FormSelectInput("a", true, array('b', 'd')));
//$form->addInput(new FormRegexInput("b", true, "/^\\d{2}-\\d{3}/", array("title" => "Kod pocztowy w formacie XX-XXX, np. 76-200")));
 *
 */
$form->addInput(new FormNumberRangeInput("Zakres", false, 10, 20, 2));
$form->addInput(new FormRegexInput("b", true, "/^\\d{2}-\\d{3}/"));
print_r($form->validateData(array("Zakres" => 13, "b" => "76-200")));
$form->addSubmit("action", "Dodaj");
echo $form->renderForm();
if (count($_POST) > 0)
{
    print_r($_POST);
    print_r($form->validateData($_POST));
}

//echo getMetascore("Diablo III");
?>
    </body>
</html>